package wangxu

import (
	"context"
	"fmt"
	"github.com/beherochuling/beesoft_api/app/helper/net"
)

// http://localhost:5235/api local
// http://localhost:5235/api docker
// https://gw.aoscdn.com/base/vip/v2
// https://aw.aoscdn.com/base/vip/v2
// https://devgw.aoscdn.com/base/vip/v2
// https://devaw.aoscdn.com/base/vip/v2

const (
	UrlWangxuHk        = "https://gw.aoscdn.com"
	UrlWangxuSz        = "https://aw.aoscdn.com"
	UrlWangxuHkTesting = "https://devgw.aoscdn.com"
	UrlWangxuSzTesting = "https://devaw.aoscdn.com"

	UriWangxuPassport = "/base/passport/v2"
	UriWangxuPayment  = "/base/payment/v2"
	UriWangxuVip      = "/base/vip/v2"
	UriWangxuVip1     = "/base/vip"

	UrlWangxuVipSdkCodesActivate  = "/sdk/codes"
	UrlWangxuVipSdkCodesActivate1 = "/mirror/activate"

	UrlWangxuVipTransactionCaptured = "/backend/transactions/capture"
)

type wangxuVip struct {
	uri string
}

func (r *wangxuVip) SetBase(uri string) *wangxuVip {
	r.uri = uri

	return r
}

func (r *wangxuVip) TransactionsCapture(ctx context.Context, data interface{}) {
	url := fmt.Sprintf("%s%s", r.uri, UrlWangxuVipTransactionCaptured)

	body := net.NewHttp(ctx).Post(url, data)
	//if err != nil {
	//	panic(err)
	//}

	fmt.Println(body)
}

func (r *wangxuVip) SdkCodesActivate(ctx context.Context, data interface{}) string {
	url := fmt.Sprintf("%s%s", r.uri, UrlWangxuVipSdkCodesActivate)

	body := net.NewHttp(ctx).
		Post(url, data)
	//if err != nil {
	//	glog.Warningf(ctx, "error: %+v", err)
	//}

	return body
}
func (r *wangxuVip) SdkCodesActivate1(ctx context.Context, data interface{}) string {
	url := fmt.Sprintf("%s%s", r.uri, UrlWangxuVipSdkCodesActivate1)

	body := net.NewHttp(ctx).
		Get(url, data)
	//if err != nil {
	//	glog.Warningf(ctx, "error: %+v", err)
	//}

	return body
}
